/* 
 * File:   tables.cpp
 * Author: ScaV
 * 
 * Created on October 28, 2011, 4:21 PM
 */

#include "tables.h"

tables::tables(int unk, int kwr, int cns, int id, int sep) {
	unknown = new nametable(unk);
	keyword = new nametable(kwr);
	constant = new nametable(cns);
	identificator = new nametable(id);
	separator = new nametable(sep);
}

tables::tables(const tables& orig) {
}

tables::~tables() {
	delete unknown;
	delete keyword;
	delete constant;
	delete identificator;
	delete separator;
}

int tables::add(lexeme *lx) {
	if (!lx)
		return -1;
	switch (lx->type) {
		case LEX_UNKNOWN:		return unknown->add(lx);		break;
		case LEX_KEYWORD:		return keyword->add(lx);		break;
		case LEX_CONSTANT:		return constant->add(lx);		break;
		case LEX_IDENTIFICATOR:	return identificator->add(lx);	break;
		case LEX_SEPARATOR:		return separator->add(lx);		break;
		default:				return -1;
	}
}

